package itheima.com.mycountdown;

import java.util.concurrent.CountDownLatch;

public class MyCountDownLatchDemo {
    public static void main(String[] args) {
        //创建CountDownLatch对象，需要传递给四个线程
        CountDownLatch countDownLatch = new CountDownLatch(3);
        //创建四个线程对象并开启他们
        MotherThread motherThread = new MotherThread(countDownLatch);
        motherThread.start();

        ChileThread1 chileThread1 = new ChileThread1(countDownLatch);
        chileThread1.setName("小明");
        ChileThread2 chileThread2 = new ChileThread2(countDownLatch);
        chileThread2.setName("小菊");
        ChileThread3 chileThread3 = new ChileThread3(countDownLatch);
        chileThread3.setName("小虎");

        chileThread1.start();
        chileThread2.start();
        chileThread3.start();
    }
}
